<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<html>
<head>
<title></title>
<link href="<s:url value='/common/lib/ligerUI/skins/Aqua/css/ligerui-all.css'/>" rel="stylesheet" type="text/css"/>
<script src="<s:url value='/common/lib/jquery/jquery-1.3.2.min.js'/>" type="text/javascript"></script>
<script src="<s:url value='/common/lib/ligerUI/js/core/base.js'/>" type="text/javascript"></script>
<script src="<s:url value='/common/lib/ligerUI/js/plugins/ligerDrag.js'/>" type="text/javascript"></script> 
<script src="<s:url value='/common/lib/ligerUI/js/plugins/ligerDialog.js'/>" type="text/javascript"></script>
<script type="text/javascript">
	var errorMsgTitle = "<s:text name='dialog.title.error'/>";
	var userPasswordErrorMsg = "<s:text name='error.user.password.empty'/>";
	$(function () {
		$("td").removeClass();
		$("td").addClass("l-table-edit-td");
		$("#oldPassword").val("");
		if($('#msg').length == 1) {
			$("#updatePassword").hide();
		}
	});
	
	function updatePasswordSubmit() {
		if($("#oldPassword").val() == "") {
			$.ligerDialog.alert(userPasswordErrorMsg, errorMsgTitle, "error");
			return false;
		}
		var newPassord = $("#newPassword").val();
		var verifiedPassword = $("#verifiedPassword").val();
		if(newPassord == "") {
			$.ligerDialog.alert("<s:text name='error.user.new.password.empty'/>", errorMsgTitle, "error");
			return false;
		}
		
		if(verifiedPassword == "") {
			$.ligerDialog.alert("<s:text name='error.user.verified.password.empty'/>", errorMsgTitle, "error");
			return false;
		}
		
		if(newPassord != verifiedPassword) {
			$.ligerDialog.alert("<s:text name='error.user.password.not.equal'/>", errorMsgTitle, "error");
			return false;
		}
		
		$("#updatePassword").submit();
	}
</script>
<style type="text/css">
    .l-table-edit {}
    .l-table-edit-td{ padding:4px;}
    .l-button-submit{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
    .errors {
		background-color:#FFCCCC;
		border:1px solid #CC0000;
		width:400px;
		margin-bottom:8px;
	}
	.errors li{ 
		list-style: none; 
	}
	.message {
		background-color:#AECAF0;
		border:1px solid #CC0000;
		width:400px;
		margin-bottom:8px;
	}
	.message li{ 
		list-style: none; 
	}
</style>
</head>

<body>
	<s:hidden name="user.account" id="hidden_user_account"/>
	<h3><s:text name="title.update.user.password"/></h3>
	
	<s:if test="hasActionErrors()">
   			<div id="errorMsg" class="errors">
      			<s:actionerror/>
   			</div>
    </s:if>
    
    <s:if test="hasActionMessages()">
   			<div id="msg" class="message">
      			<s:actionmessage/>
   			</div>
    </s:if>
	
	<form id="updatePassword" name="updatePassword" method="post" action="/aim/user/updatePassword.action">
		<div></div>
        <table cellpadding="0" cellspacing="0" class="l-table-edit" >
            <s:password name="oldPassword" label="%{getText('label.user.old.password')}" cssStyle="border:1px solid #AECAF0; width: 130px; height:20px;"/>
            <s:password name="newPassword" label="%{getText('label.user.new.password')}" cssStyle="border:1px solid #AECAF0; width: 130px; height:20px;"/>
            <s:password name="verifiedPassword" label="%{getText('label.user.verified.password')}" cssStyle="border:1px solid #AECAF0; width: 130px; height:20px;"/>
        </table>
 		<br/>
		<input type="button" value="<s:text name='button.update'/>" id="submitButton" class="l-button l-button-submit" onclick="updatePasswordSubmit()" />
    </form>
</body>
</html>